<?php
require("dbinit.php");
$indexTour = $_POST["indexTour"];

function loadProgramForm($colType,$indexResource,$thisDayIndex,$thisProgramIndex,$colTimestart,$colTimeend,$indexProgram) {
	$thisID = "d" . $thisDayIndex . "_p" . $thisProgramIndex;
	require("dbinit.php");
	switch ($colType) {
		case "interest":
			$query2 = "SELECT colInterestname, colInterestdescription, colInterestsite, colInterestpositiongoogle FROM tiInterestInformation WHERE indexResource=" . $indexResource;
			$selectInterest=" selected='selected'";$selectFood="";$selectActivity="";$selectHotel="";$selectTransportation="";$selectSchedule="";$selectLabel="interest";
			break;
		case "food":
			$query2 = "SELECT colFoodname, colFoodcategory, colFoodpricerange, colFooddescription, colFoodsite, colFoodpositiongoogle, colFoodaddress, colFoodtelephone, colFoodcreditecard FROM tiFoodinformation WHERE indexResource=" . $indexResource;
			$selectInterest="";$selectFood=" selected='selected'";$selectActivity="";$selectHotel="";$selectTransportation="";$selectSchedule="";$selectLabel="food";
			break;
		case "activity":
			$query2 = "SELECT colActivityname, colActivitydescription, colActivitysite, colActivityaddress, colActivitypositiongoogle, colActivitycategory FROM tiActivityinformation WHERE indexResource=" . $indexResource;
			$selectInterest="";$selectFood="";$selectActivity=" selected='selected'";$selectHotel="";$selectTransportation="";$selectSchedule="";$selectLabel="activity";
			break;
		case "hotel":
			$query2 = "SELECT colHotelname, colHotelpositiongoogle, colHoteldescription, colHotelsite, colHotelsite, colHotelcategory, colHotelstar, colHotelroomtype, colHotelprice, colHoteladdress, colHoteltelephone, colHotelcreditecard FROM tiHotelinformation WHERE indexResource=" . $indexResource;
			$selectInterest="";$selectFood="";$selectActivity="";$selectHotel=" selected='selected'";$selectTransportation="";$selectSchedule="";$selectLabel="hotel";
			break;
		case "transportation":
			$query2 = "SELECT colTransportationname, colTransportationcategory, colTransportationcompany, colTransportationsite, colTransportationdescription FROM tiTransportationInformation WHERE indexResource=" . $indexResource;
			$selectInterest="";$selectFood="";$selectActivity="";$selectHotel="";$selectTransportation=" selected='selected'";$selectSchedule="";$selectLabel="transportation";
			break;
		case "schedule":
			$query2 = "SELECT colSchedulename, colScheduledescription FROM tiScheduleinformation WHERE indexResource=" . $indexResource;
			$selectInterest="";$selectFood="";$selectActivity="";$selectHotel="";$selectTransportation="";$selectSchedule=" selected='selected'";$selectLabel="schedule";
	}	
	$result2 = mysql_query($query2, $link);
	$row2 = mysql_fetch_row($result2);
	echo "<li class='ui-state-default formProgram_$thisID' name='formProgram_$thisID' id='formProgram_$thisID'>";
	echo "<input type='hidden' name='indexCourse' id='indexCourse' value='$indexTour' />";
	echo "<input type='hidden' name='indexProgram_$thisID' id='indexProgram_$thisID' value='$indexProgram' />";
	echo "<input type='hidden' name='indexResource_$thisID' id='indexResource_$thisID' value='$indexResource' />";
	echo "<select name='program_select_$thisID' id='program_select_$thisID' onChange='program_select(\"program_select_$thisID\");'><option value='null'> -- </option><option value='interest' $selectInterest>Interest</option><option value='food' $selectFood>Food</option><option value='activity' $selectActivity>Activity</option><option value='hotel' $selectHotel>Hotel</option><option value='transportation' $selectTransportation>Transportation</option><option value='schedule' $selectSchedule>Schedule</option></select>";
	echo "<input name='program_name_$thisID' id='program_name_$thisID' type='text' style='width:10em;' value='" . $row2[0] . "' />";
	echo "Start at:<input type='text' class='myTimePicker' name='program_starttime_$thisID' id='program_starttime_$thisID' style='width:5em;' value='$colTimestart' />";
	echo "End at:<input type='text' class='myTimePicker' name='program_endtime_$thisID' id='program_endtime_$thisID' style='width:5em;' value='$colTimeend' /> ";
	echo "<input type='image' src='./img/icon/Browse-64.png' class='program_open' name='PanelProgramOpen_$thisID' id='PanelProgramOpen_$thisID' onClick='program_open(\"PanelProgramOpen_$thisID\");'/> ";
	echo "<input type='image' src='./img/icon/ok-32.png' name='program_detail_addok_btn_$thisID' id='program_detail_addok_btn_'$thisID onclick='program_detail_addok_btn(\"$thisID\",\"edit\");' /> ";
	echo "<div id='PanelProgramDetail_$thisID' name='PanelProgramDetail_$thisID' style='display:none;'>";

			
	switch ($colType) {
		case "interest":		
			echo "<input type='image' src='img/icon/link-36.png' name='interest_sitebtn_$thisID' id='interest_sitebtn_$thisID' alt='Official Site' onclick='open_program_detailitem(\"interest_sitebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/map-32.png' name='interest_googleurlbtn_$thisID' id='interest_googleurlbtn_$thisID' alt='Google Map' onclick='open_program_detailitem(\"interest_googleurlbtn_$thisID\");'/> ";
			echo "<input type='image' src='img/icon/comments-24.png' name='interest_descriptionbtn_$thisID' id='interest_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"interest_descriptionbtn_$thisID\");'/> ";
			echo "<input type='image' src='img/icon/copy24.png' name='interest_refnamebtn_$thisID' id='interest_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"interest_refnamebtn_$thisID\");'/>";
			echo "<div id='interest_sitebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_sitebtn_" . $thisID . "_div\")' />Official Site<input name='interest_site_$thisID' id='interest_site_$thisID' type='text' value='$row2[2]' /></div>";
			echo "<div id='interest_googleurlbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_googleurlbtn_" . $thisID . "_div\")' />Google Map<input type='text' name='interest_googleurl_$thisID' id='interest_googleurl_$thisID' value='$row2[3]' /><input type='image' src='img/icon/tryit.png	' name='interest_googlepreview_$thisID' id='interest_googlepreview_$thisID' class='googlepreview' value='=>' onClick='googlepreview(\"interest_googlepreview_$thisID\");' /><div name='interest_googlepage_$thisID' id='interest_googlepage_$thisID'><div name='interest_googlepagedetail_$thisID' id='interest_googlepagedetail_$thisID'></div></div></div>";
			echo "<div id='interest_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_descriptionbtn_$this" . $thisID . "_divID_div\")' />Description<input size='59' type='text' name='interest_description_$thisID' id='interest_description_$thisID' value='$row2[1]' /></div>";
			echo "<div id='interest_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='interest_refname_$thisID' id='interest_refname_$thisID' />
						URL:<input type='text' name='interest_refurl_$thisID' id='interest_refurl_$thisID' />
						<input type='image' src='img/icon/add1-24.png' name='interest_refsubmit_$thisID' id='interest_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"interest_refsubmit_$thisID\");' /><br />
						<div name='interest_attachpage_$thisID' id='interest_attachpage_$thisID'>";
			break;
		case "food":
			echo "<input type='image' src='img/icon/link-36.png' name='food_sitebtn_$thisID' id='food_sitebtn_$thisID' alt='Official Site' onclick='open_program_detailitem(\"food_sitebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/archive-24.png' name='food_categorybtn_$thisID' id='food_categorybtn_$thisID' alt='Category' onclick='open_program_detailitem(\"food_categorybtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/coins.png' name='food_pricerangebtn_$thisID' id='food_pricerangebtn_$thisID' alt='Price Range' onclick='open_program_detailitem(\"food_pricerangebtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/credit_cards.png' name='food_creditecardbtn_$thisID' id='food_creditecardbtn_$thisID' alt='Credite Card' onclick='open_program_detailitem(\"food_creditecardbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/addressbook24.png' name='food_addressbtn_$thisID' id='food_addressbtn_$thisID' alt='Address' onclick='open_program_detailitem(\"food_addressbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/office5_24.png' name='food_phonebtn_$thisID' id='food_phonebtn_$thisID' alt='Telephone' onclick='open_program_detailitem(\"food_phonebtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/map-32.png' name='food_googleurlbtn_$thisID' id='food_googleurlbtn_$thisID' alt='Google Map' onclick='open_program_detailitem(\"food_googleurlbtn_$thisID\");'/>";
			echo "<input type='image' src='img/icon/comments-24.png' name='food_descriptionbtn_$thisID' id='food_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"food_descriptionbtn_$thisID\");'/>";
			echo "<input type='image' src='img/icon/copy24.png' name='food_refnamebtn_$thisID' id='food_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"food_refnamebtn_$thisID\");'/>";
			echo "<div id='food_sitebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_sitebtn_" . $thisID . "_div\")' />Official Site<input name='food_site_$thisID' id='food_site_$thisID' type='text' value='$row2[4]' /></div>";
			echo "<div id='food_categorybtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_categorybtn_" . $thisID . "_div\")' />Category<select name='food_category_$thisID' id='food_category_$thisID' value='$row2[1]'><option value='Chinese Food'>Chinese Food</option><option value='Fast Food'>Fast Food</option><option value='Japanese Food'>Japanese Food</option></select></div>";
			echo "<div id='food_pricerangebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_pricerangebtn_" . $thisID . "_div\")' />Price Range<input name='food_pricerange_$thisID' id='food_pricerange_$thisID' type='text' value='$row2[2]' /></div> ";
			echo "<div id='food_creditecardbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_creditecardbtn_" . $thisID . "_div\")' />Credite Card<input name='food_creditecard_$thisID' id='food_creditecard_$thisID' type='text' value='$row2[8]' /></div>";
			echo "<div id='food_addressbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_addressbtn_" . $thisID . "_div\")' />Address<input name='food_address_$thisID' id='food_address_$thisID' type='text' value='$row2[6]' /></div>";
			echo "<div id='food_phonebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_phonebtn_" . $thisID . "_div\")' />Telephone<input name='food_phone_$thisID' id='food_phone_$thisID' type='text' value='$row2[7]' /></div>";
			echo "<div id='food_googleurlbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_googleurlbtn_" . $thisID . "_div\")' />Google Map<input type='text' name='food_googleurl_$thisID' id='food_googleurl_$thisID' value='$row2[5]' /><input type='image' src='img/icon/tryit.png	' name='food_googlepreview_$thisID' id='food_googlepreview_$thisID' class='googlepreview' value='=>' onClick='googlepreview(\"food_googlepreview_$thisID\");' /><div name='food_googlepage_$thisID' id='food_googlepage_$thisID'><div name='food_googlepagedetail_$thisID' id='food_googlepagedetail_$thisID'></div></div></div>";
			echo "<div id='food_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_descriptionbtn_" . $thisID . "_div\")' />Description<input size='59' type='text' name='food_description_$thisID' id='food_description_$thisID' value='$row2[3]' /></div>";
			echo "<div id='food_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='food_refname_$thisID' id='food_refname_$thisID' />
						URL:<input type='text' name='food_refurl_$thisID' id='food_refurl_$thisID' />
						<input type='image' src='img/icon/add1-24.png' name='food_refsubmit_$thisID' id='food_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"food_refsubmit_$thisID\");' /><br />
						<div name='food_attachpage_$thisID' id='food_attachpage_$thisID'>";
			break;
		case "activity":
			echo "<input type='image' src='img/icon/link-36.png' name='activity_sitebtn_$thisID' id='activity_sitebtn_$thisID' alt='Official Site' onclick='open_program_detailitem(\"activity_sitebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/archive-24.png' name='activity_categorybtn_$thisID' id='activity_categorybtn_$thisID' alt='Category' onclick='open_program_detailitem(\"activity_categorybtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/map-32.png' name='activity_googleurlbtn_$thisID' id='activity_googleurlbtn_$thisID' alt='Google Map' onclick='open_program_detailitem(\"activity_googleurlbtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/comments-24.png' name='activity_descriptionbtn_$thisID' id='activity_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"activity_descriptionbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/copy24.png' name='activity_refnamebtn_$thisID' id='activity_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"activity_refnamebtn_$thisID\");' />";
			echo "<div id='activity_sitebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_sitebtn_" . $thisID . "_div\")' />Official Site<input name='activity_site_$thisID' id='activity_site_$thisID' type='text' value='$row2[2]'/></div>";
			echo "<div id='activity_categorybtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_categorybtn_" . $thisID . "_div\")' />Category<select name='activity_category_$thisID' id='activity_category_$thisID' value='$row2[5]'><option value='Dance'>Dance</option><option value='Outdoor'>Outdoor</option><option value='Seminar'>Seminar</option></select></div>";
			echo "<div id='activity_googleurlbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_googleurlbtn_" . $thisID . "_div\")' />Google Map<input type='text' name='activity_googleurl_$thisID' id='activity_googleurl_$thisID' value='$row2[4]'/><input type='image' src='img/icon/tryit.png	' name='activity_googlepreview_$thisID' id='activity_googlepreview_$thisID' class='googlepreview' value='=>' onClick='googlepreview(\"activity_googlepreview_$thisID\");' /><div name='activity_googlepage_$thisID' id='activity_googlepage_$thisID'><div name='activity_googlepagedetail_$thisID' id='activity_googlepagedetail_$thisID'></div></div></div>";
			echo "<div id='activity_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_descriptionbtn_" . $thisID . "_div\")' />Description<input size='59' type='text' name='activity_description_$thisID' id='activity_description_$thisID' value='$row2[1]' /></div>";
			echo "<div id='activity_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='activity_refname_$thisID' id='activity_refname_$thisID' />
						URL:<input type='text' name='activity_refurl_$thisID' id='activity_refurl_$thisID' />
						<input type='image' src='img/icon/add1-24.png' name='activity_refsubmit_$thisID' id='activity_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"activity_refsubmit_$thisID\");' /><br />
						<div name='activity_attachpage_$thisID' id='activity_attachpage_$thisID'>";
			break;
		case "hotel":
			echo "<input type='image' src='img/icon/link-36.png' name='hotel_sitebtn_$thisID' id='hotel_sitebtn_$thisID' alt='Official Site' onclick='open_program_detailitem(\"hotel_sitebtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/archive-24.png' name='hotel_categorybtn_$thisID' id='hotel_categorybtn_$thisID' alt='Category' onclick='open_program_detailitem(\"hotel_categorybtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/Favorite_24x24.png' name='hotel_starbtn_$thisID' id='hotel_starbtn_$thisID' alt='Star' onclick='open_program_detailitem(\"hotel_starbtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/Home.png' name='hotel_roombtn_$thisID' id='hotel_roombtn_$thisID' alt='Room Type' onclick='open_program_detailitem(\"hotel_roombtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/coins.png' name='hotel_pricerangebtn_$thisID' id='hotel_pricerangebtn_$thisID' alt='Price Range' onclick='open_program_detailitem(\"hotel_pricerangebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/credit_cards.png' name='hotel_creditecardbtn_$thisID' id='hotel_creditecardbtn_$thisID' alt='Credite Card' onclick='open_program_detailitem(\"hotel_creditecardbtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/addressbook24.png' name='hotel_addressbtn_$thisID' id='hotel_addressbtn_$thisID' alt='Address' onclick='open_program_detailitem(\"hotel_addressbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/office5_24.png' name='hotel_phonebtn_$thisID' id='hotel_phonebtn_$thisID' alt='Telephone' onclick='open_program_detailitem(\"hotel_phonebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/map-32.png' name='hotel_googleurlbtn_$thisID' id='hotel_googleurlbtn_$thisID' alt='Google Map' onclick='open_program_detailitem(\"hotel_googleurlbtn_$thisID\");'/> ";
			echo "<input type='image' src='img/icon/comments-24.png' name='hotel_descriptionbtn_$thisID' id='hotel_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"hotel_descriptionbtn_$thisID\");'/> ";
			echo "<input type='image' src='img/icon/copy24.png' name='hotel_refnamebtn_$thisID' id='hotel_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"hotel_refnamebtn_$thisID\");'/>";
			echo "<div id='hotel_sitebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_sitebtn_" . $thisID . "_div\")' />Official Site<input name='hotel_site_$thisID' id='hotel_site_$thisID' type='text' value='$row2[4]' /></div>";
			echo "<div id='hotel_categorybtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_categorybtn_" . $thisID . "_div\")' />Category<select name='hotel_category_$thisID' id='hotel_category_$thisID' value='$row2[5]'><option value='Hotel'>Hotel</option><option value='Motel'>Motel</option><option value='Hostel'>Hostel</option><option value='Dorm'>Dorm</option></select></div>";
			echo "<div id='hotel_starbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_starbtn_" . $thisID . "_div\")' />Star<select name='hotel_star_$thisID' id='hotel_star_$thisID' value='$row2[6]'><option value='6'>over 5 Star</option><option value='5'>5 Star</option><option value='4'>4 Star</option><option value='3'>3 Star</option><option value='2'>2 Star</option><option value='1'>1 Star</option><option value='0'>N/A</option></select></div>";
			echo "<div id='hotel_roombtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_roombtn_" . $thisID . "_div\")' />Room Type<select name='hotel_room_$thisID' id='hotel_room_$thisID' value='$row2[7]'><option value='1-1s'>X1, One Standard</option><option value='2-2s'>X2, Two Standard</option><option value='2-1k'>X2, One King Size</option><option value='others'>Others</option></select></div>";
			echo "<div id='hotel_pricerangebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_pricerangebtn_" . $thisID . "_div\")' />Price Range<input name='hotel_pricerange_$thisID' id='hotel_pricerange_$thisID' type='text' value='$row2[8]' /></div>";
			echo "<div id='hotel_creditecardbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_creditecardbtn_" . $thisID . "_div\")' />Credite Card<input name='hotel_creditecard_$thisID' id='hotel_creditecard_$thisID' type='text' value='$row2[11]' /></div>";
			echo "<div id='hotel_addressbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_addressbtn_" . $thisID . "_div\")' />Address<input name='hotel_address_$thisID' id='hotel_address_$thisID' type='text' value='$row2[9]' /></div>";
			echo "<div id='hotel_phonebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_phonebtn_" . $thisID . "_div\")' />Telephone<input name='hotel_phone_$thisID' id='hotel_phone_$thisID' type='text' value='$row2[10]' /></div>";
			echo "<div id='hotel_googleurlbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_googleurlbtn_" . $thisID . "_div\")' />Google Map<input type='text' name='hotel_googleurl_$thisID' id='hotel_googleurl_$thisID' value='$row2[1]' /><input type='image' src='img/icon/tryit.png	' name='hotel_googlepreview_$thisID' id='hotel_googlepreview_$thisID' class='googlepreview' value='=>' onClick='googlepreview(\"hotel_googlepreview_$thisID\");' /><div name='hotel_googlepage_$thisID' id='hotel_googlepage_$thisID'><div name='hotel_googlepagedetail_$thisID' id='hotel_googlepagedetail_$thisID'></div></div></div>";
			echo "<div id='hotel_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_descriptionbtn_" . $thisID . "_div\")' />Description<input size='59' type='text' name='hotel_description_$thisID' id='hotel_description_$thisID' value='$row2[2]' /></div>";
			echo "<div id='hotel_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='hotel_refname_$thisID' id='hotel_refname_$thisID' />
						URL:<input type='text' name='hotel_refurl_$thisID' id='hotel_refurl_$thisID' /><
						input type='image' src='img/icon/add1-24.png' name='hotel_refsubmit_$thisID' id='hotel_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"hotel_refsubmit_$thisID\");' /><br />
						<div name='hotel_attachpage_$thisID' id='hotel_attachpage_$thisID'>";
			break;
		case "transportation":
			echo "<input type='image' src='img/icon/link-36.png' name='transportation_sitebtn_$thisID' id='transportation_sitebtn_$thisID' alt='Official Site' onclick='open_program_detailitem(\"transportation_sitebtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/archive-24.png' name='transportation_categorybtn_$thisID' id='transportation_categorybtn_$thisID' alt='Category' onclick='open_program_detailitem(\"transportation_categorybtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/CabrioletRed.png' name='transportation_companybtn_$thisID' id='transportation_companybtn_$thisID' alt='Company' onclick='open_program_detailitem(\"transportation_companybtn_$thisID\");' /> ";
			echo "<input type='image' src='img/icon/comments-24.png' name='transportation_descriptionbtn_$thisID' id='transportation_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"transportation_descriptionbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/copy24.png' name='transportation_refnamebtn_$thisID' id='transportation_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"transportation_refnamebtn_$thisID\");' />";
			echo "<div id='transportation_sitebtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_sitebtn_" . $thisID . "_div\")' />Official Site<input name='transportation_site_$thisID' id='transportation_site_$thisID' type='text' value='$row2[3]'/></div>";
			echo "<div id='transportation_categorybtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_categorybtn_" . $thisID . "_div\")' />Category<select name='transportation_category_$thisID' id='transportation_category_$thisID' value='$row2[1]'><option value='Airplant'>Airplant</option><option value='Train'>Train</option><option value='Bus'>Bus</option><option value='Subway'>Subway</option><option value='Boat'>Boat</option></select></div>";
			echo "<div id='transportation_companybtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_companybtn_" . $thisID . "_div\")' />Company<input type='text' name='transportation_company_$thisID' id='transportation_company_$thisID' value='$row2[2]'/></div>";
			echo "<div id='transportation_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_descriptionbtn_" . $thisID . "_div\")' />Description<input size='59' type='text' name='transportation_description_$thisID' id='transportation_description_$thisID' value='$row2[4]' /></div>";
			echo "<div id='transportation_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='transportation_refname_$thisID' id='transportation_refname_$thisID' />
						URL:<input type='text' name='transportation_refurl_$thisID' id='transportation_refurl_$thisID' />
						<input type='image' src='img/icon/add1-24.png' name='transportation_refsubmit_$thisID' id='transportation_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"transportation_refsubmit_$thisID\");' /><br />
						<div name='transportation_attachpage_$thisID' id='transportation_attachpage_$thisID'>";
			break;
		case "schedule":
			echo "<input type='image' src='img/icon/comments-24.png' name='schedule_descriptionbtn_$thisID' id='schedule_descriptionbtn_$thisID' alt='Description' onclick='open_program_detailitem(\"schedule_descriptionbtn_$thisID\");' />";
			echo "<input type='image' src='img/icon/copy24.png' name='schedule_refnamebtn_$thisID' id='schedule_refnamebtn_$thisID' alt='Reference Information' onclick='open_program_detailitem(\"schedule_refnamebtn_$thisID\");' />";
			echo "<div id='schedule_descriptionbtn_" . $thisID . "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"schedule_descriptionbtn_" . $thisID . "_div\")' />Description<input size='59' type='text' name='schedule_description_$thisID' id='schedule_description_$thisID' value='$row2[1]' /></div>";
			echo "<div id='schedule_refnamebtn_" . $thisID . "_div' style='display:none;'>
						<input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"schedule_refnamebtn_" . $thisID . "_div\")' />
						Reference Information<input type='text' name='schedule_refname_$thisID' id='schedule_refname_$thisID' />
						URL:<input type='text' name='schedule_refurl_$thisID' id='schedule_refurl_$thisID' />
						<input type='image' src='img/icon/add1-24.png' name='schedule_refsubmit_$thisID' id='schedule_refsubmit_$thisID' class='refsubmit' value='add' onClick='refsubmit(\"schedule_refsubmit_$thisID\");' /><br />
						<div name='schedule_attachpage_$thisID' id='schedule_attachpage_$thisID'>";
	} //end switch
	
	$query3 = "SELECT colResourcelink, colResourcelinkname FROM tiResourcelink where indexResource=" . $indexResource ;
	$result3 = mysql_query($query3, $link);
	echo	"			<input type='hidden' name='" . $selectLabel . "_attachurlcount_$thisID' id='" . $selectLabel . "_attachurlcount_$thisID' value='" . mysql_num_rows($result3) . "' />";
	$thisRefIndex = 0;
	while ($row3 = mysql_fetch_assoc($result3)) {
		$thisRefIndex++;
		$divname = "link_" . $thisID . "_" . $thisRefIndex;
		echo "<div name='$divname' id='$divname'>";
		echo "		<hr />Reference Name:" . $row3["colResourcelinkname"] ;
		echo "		<input type='image' src='img/icon/delete24.png' name='r$divname' id='r$divname' onclick='$(\"#$divname\").remove();' value='remove'  /><br />";
		echo "		<iframe name='p$divname' id='p$divname' src='" . $row3["colResourcelink"] . "' width='500' heigh='200' style='border:1px'></iframe>";
		echo "		<input type='hidden' name='colResourcelink_$divname' id='colResourcelink_$divname' value='" . $row3["colResourcelink"] . "' />";
		echo "		<input type='hidden' name='colResourcelinkname_$divname' id='colResourcelinkname_$divname' value='" . $row3["colResourcelinkname"] . "' />";
		echo "</div>";	
	}
	echo "</div></div>";
	echo "</div></li>";	
	
}

$query = "SELECT colEmail, colTourname, colDatestart, colDateend, colPeopleCount, colTourdescription, datediff(colDateend, colDatestart) as diffdate FROM ucMaintour where indexTour=" . $indexTour;
$result = mysql_query($query, $link);

if ($result) {
	$row = mysql_fetch_row($result);
	$colDatestart = $row[2];
	$colDateend = $row[3];
	$diffdate = $row[6];
?>
<div id="MainTabArea" class="tabs">
		<ul>
			<li><a href="#tabs-tour">Tour</a></li>
			<li><a href="#tabs-details">Details</a></li>
		</ul>
		<div id="tabs-tour">
		<input type="hidden" name="day_count" id="day_count" value="<?php if ($diffdate >= 0) {echo $diffdate+1;} else {echo "0";} ?>" /> 
			<table>
				<tr><td>Tour Name:</td><td><input type="text" name="tour_name" id="tour_name" value="<?php echo $row[1]; ?>" disabled="disabled" style="color:black;width:30em;"/></td></tr>
				<tr><td>Start on:</td><td><input type="text" class="myDatePicker_tour" name="tour_startdate" id="tour_startdate" value="<?php echo date("m/d/o", strtotime($row[2])); ?>" disabled="disabled" style="color:black;" /></td></tr>
				<tr><td>End on:</td><td><input type="text" class="myDatePicker_tour" name="tour_enddate" id="tour_enddate" value="<?php echo date("m/d/o", strtotime($row[3])); ?>" disabled="disabled" style="color:black;" /></td></tr>
				<tr><td>People:</td><td><input type="text" name="tour_people" id="tour_people" value="<?php echo $row[4]; ?>" disabled="disabled" style="color:black;" /></td></tr>
				<tr><td>Description:</td><td><textarea rows="5" cols="45" name="tour_description" id="tour_description" disabled="disabled" style="color:black;"><?php echo $row[5]; ?></textarea>     <!-- <input type="text" name="tour_description" id="tour_description" value="<?php echo $row[5]; ?>" disabled="disabled" style="color:black;" /> --></td></tr>
				<tr><td> </td><td><input name="edit_tour_basic_information" id="edit_tour_basic_information" type="button" value="edit" onclick="edit_tour_basic_information();" /></td></tr>
			</table>
		</div>
		<div id="tabs-details" class="accordion">
<?php 
for ($i=0;$i<=$diffdate;$i++) {
	$thisDayIndex = $i+1;
	//$query ="SELECT indexProgram FROM ucCrouseday WHERE indexCourse=$indexTour and colDay=$thisDayIndex";
	$query = "SELECT Cd.indexCourse, Cd.indexProgram, Pr.indexResource, Cd.ColDay, Pr.colType, Ps.colOrder, Ps.colTimestart, Ps.colTimeend FROM mydb.ucCrouseday Cd, mydb.ucProgramresources Pr, mydb.ucProgramschedule Ps ";
	$query .= "WHERE Cd.indexProgram=Pr.indexProgram AND Cd.indexProgram=Ps.indexProgram AND Cd.indexCourse=$indexTour AND Cd.ColDay=$thisDayIndex ";
	$query .= "ORDER BY Ps.colTimestart";
	$result = mysql_query($query, $link);
?>
			<h3><a href="#">Day <?php echo $thisDayIndex;?> [<?php echo dateadd("d", $i,$colDatestart); ?>]</a></h3><?php  //change the 0 by count from DB?>
			<div id="divDay_d<?php echo $thisDayIndex;?>">
				<input type="hidden" name="program_count_d<?php echo $thisDayIndex;?>" id="program_count_d<?php echo $thisDayIndex;?>" value="<?php if (mysql_num_rows($result) > 0) {echo mysql_num_rows($result); } else {echo "0";} ?>" /> 
				<ul class="sortable panelProgram"  id="panelProgram_d<?php echo $thisDayIndex;?>" name="panelProgram_d<?php echo $thisDayIndex;?>">
					<?php 
						$thisProgramIndex = 0;
						while ($row = mysql_fetch_assoc($result)) { 
							$thisProgramIndex++;
							loadProgramForm($row["colType"],$row["indexResource"],$thisDayIndex,$thisProgramIndex,$row["colTimestart"],$row["colTimeend"],$row["indexProgram"]);
						 }?>
				</ul>
				<span name="addprogram_d<?php echo $thisDayIndex;?>" id="addprogram_d<?php echo $thisDayIndex;?>" class="ui-icon ui-icon-plusthick addProgram" style="cursor:pointer;" onClick="addprogram('d<?php echo $thisDayIndex;?>');" ></span>
			</div>
<?php 
}
?>
		</div>
</div>
<?php 
} else {
	echo "Error :: null, exception.";
}
mysql_close($link);

function DateAdd ($interval, $number, $date) {
$date_time_array = getdate(strtotime($date));
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
switch ($interval) {
case "yyyy": $year +=$number; break;
case "q": $month +=($number*3); break;
case "m": $month +=$number; break;
case "y":
case "d":
case "w": $day+=$number; break;
case "ww": $day+=($number*7); break;
case "h": $hours+=$number; break;
case "n": $minutes+=$number; break;
case "s": $seconds+=$number; break;
}
$timestamp = mktime($hours ,$minutes, $seconds,$month ,$day, $year);
return strftime( "%m/%d/%Y",$timestamp) ;
}
?>
<script language="javascript">
/* Custom function: Tour > Course > Day > Program: Program Form
to Create Program Form for each day. */
function addprogram(myDayID){
		var thisProgramCount = $("#program_count_" + myDayID).attr("value");
		thisProgramCount++;
		$("#program_count_" + myDayID).attr("value",thisProgramCount);
		thisPanelProgram = "#panelProgram_" + myDayID;
		myProgramID =  myDayID + "_p" + thisProgramCount;
		myStr = "<li class='ui-state-default formProgram_" + myProgramID + "' name='formProgram_" + myProgramID + "' id='formProgram_" + myProgramID + "'>";
		myStr = myStr + "<select name='program_select_" + myProgramID + "' id='program_select_" + myProgramID + "' onChange='program_select(\"program_select_" + myProgramID + "\");'><option value='null'> -- </option><option value='interest'>Interest</option><option value='food'>Food</option><option value='activity'>Activity</option><option value='hotel'>Hotel</option><option value='transportation'>Transportation</option><option value='schedule'>Schedule</option></select>";
		myStr = myStr + "<input type='hidden' name='indexCourse' id='indexCourse' value='<?php echo $indexTour; ?>' />";
		myStr = myStr + "<input name='program_name_" + myProgramID + "' id='program_name_" + myProgramID + "' type='text' style='width:10em;' />";
		//myStr = myStr + "<span><b>New Program</b></span><br />";
		myStr = myStr + "Start at:<input type='text' class='myTimePicker' name='program_starttime_" + myProgramID + "' id='program_starttime_" + myProgramID + "' style='width:5em;' />";
		myStr = myStr + "End at:<input type='text' class='myTimePicker' name='program_endtime_" + myProgramID + "' id='program_endtime_" + myProgramID + "' style='width:5em;' /> ";
		myStr = myStr + "<input type='image' src='./img/icon/Browse-64.png' class='program_open' name='PanelProgramOpen_" + myProgramID + "' id='PanelProgramOpen_" + myProgramID + "' onClick='program_open(\"PanelProgramOpen_" + myProgramID + "\");'/> ";
		myStr = myStr + "<input type='image' src='./img/icon/Add-32.png' name='program_detail_addok_btn_" + myProgramID + "' id='program_detail_addok_btn_" + myProgramID + "' onclick='program_detail_addok_btn(\"" + myProgramID + "\",\"add\");' /> ";
		myStr = myStr + "<div id='PanelProgramDetail_" + myProgramID + "' name='PanelProgramDetail_" + myProgramID + "'></div>";
		myStr = myStr + "</li>";
		//alert(myStr);
		$("#panelProgram_" + myDayID).append(myStr);

	$(".sortable").sortable({
		placeholder: 'ui-state-highlight'
	});
	$(".sortable").disableSelection();
	}

/* Custom function: Tour > Course > Day > Program: 
to define the program type and create the form, such as interest, hotel, etc. */
function program_select(program_select_ID){
myArry = program_select_ID.split("_");
myID = myArry[2] + "_" + myArry[3];
thisObj = "#" + program_select_ID;
//thisPanelProgramDetail = "#" + $("#" + program_select_ID + "+br+div").attr("id");
thisPanelProgramDetail = "#PanelProgramDetail_" + myID;

switch ($("#" + program_select_ID).val()) {
case "null":
	$(thisPanelProgramDetail).remove();
	break;
case "interest":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/link-36.png' name='interest_sitebtn_" + myID + "' id='interest_sitebtn_" + myID + "' alt='Official Site' onclick='open_program_detailitem(\"interest_sitebtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/map-32.png' name='interest_googleurlbtn_" + myID + "' id='interest_googleurlbtn_" + myID + "' alt='Google Map' onclick='open_program_detailitem(\"interest_googleurlbtn_" + myID + "\");'/> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='interest_descriptionbtn_" + myID + "' id='interest_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"interest_descriptionbtn_" + myID + "\");'/> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='interest_refnamebtn_" + myID + "' id='interest_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"interest_refnamebtn_" + myID + "\");'/>");
	$("#PanelProgramDetail_" + myID).append("<div id='interest_sitebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_sitebtn_" + myID + "_div\")' />Official Site<input name='interest_site_" + myID + "' id='interest_site_" + myID + "' type='text' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='interest_googleurlbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_googleurlbtn_" + myID + "_div\")' />Google Map<input type='text' name='interest_googleurl_" + myID + "' id='interest_googleurl_" + myID + "' /><input type='image' src='img/icon/tryit.png	' name='interest_googlepreview_" + myID + "' id='interest_googlepreview_" + myID + "' class='googlepreview' value='=>' onClick='googlepreview(\"interest_googlepreview_" + myID + "\");' /><div name='interest_googlepage_" + myID + "' id='interest_googlepage_" + myID + "'><div name='interest_googlepagedetail_" + myID + "' id='interest_googlepagedetail_" + myID + "'></div></div></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='interest_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='interest_description_" + myID + "' id='interest_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='interest_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"interest_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='interest_refname_" + myID + "' id='interest_refname_" + myID + "' />URL:<input type='text' name='interest_refurl_" + myID + "' id='interest_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='interest_refsubmit_" + myID + "' id='interest_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"interest_refsubmit_" + myID + "\");' /><br /><div name='interest_attachpage_" + myID + "' id='interest_attachpage_" + myID + "'><input type='hidden' name='interest_attachurlcount_" + myID + "' id='interest_attachurlcount_" + myID + "' value='0' /></div></div>");
	break;
case "food":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/link-36.png' name='food_sitebtn_" + myID + "' id='food_sitebtn_" + myID + "' alt='Official Site' onclick='open_program_detailitem(\"food_sitebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/archive-24.png' name='food_categorybtn_" + myID + "' id='food_categorybtn_" + myID + "' alt='Category' onclick='open_program_detailitem(\"food_categorybtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/coins.png' name='food_pricerangebtn_" + myID + "' id='food_pricerangebtn_" + myID + "' alt='Price Range' onclick='open_program_detailitem(\"food_pricerangebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/credit_cards.png' name='food_creditecardbtn_" + myID + "' id='food_creditecardbtn_" + myID + "' alt='Credite Card' onclick='open_program_detailitem(\"food_creditecardbtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/addressbook24.png' name='food_addressbtn_" + myID + "' id='food_addressbtn_" + myID + "' alt='Address' onclick='open_program_detailitem(\"food_addressbtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/office5_24.png' name='food_phonebtn_" + myID + "' id='food_phonebtn_" + myID + "' alt='Telephone' onclick='open_program_detailitem(\"food_phonebtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/map-32.png' name='food_googleurlbtn_" + myID + "' id='food_googleurlbtn_" + myID + "' alt='Google Map' onclick='open_program_detailitem(\"food_googleurlbtn_" + myID + "\");'/>");  
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='food_descriptionbtn_" + myID + "' id='food_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"food_descriptionbtn_" + myID + "\");'/>"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='food_refnamebtn_" + myID + "' id='food_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"food_refnamebtn_" + myID + "\");'/>");
	$("#PanelProgramDetail_" + myID).append("<div id='food_sitebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_sitebtn_" + myID + "_div\")' />Official Site<input name='food_site_" + myID + "' id='food_site_" + myID + "' type='text' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='food_categorybtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_categorybtn_" + myID + "_div\")' />Category<select name='food_category_" + myID + "' id='food_category_" + myID + "'><option value='Chinese Food'>Chinese Food</option><option value='Fast Food'>Fast Food</option><option value='Japanese Food'>Japanese Food</option></select></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='food_pricerangebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_pricerangebtn_" + myID + "_div\")' />Price Range<input name='food_pricerange_" + myID + "' id='food_pricerange_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='food_creditecardbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_creditecardbtn_" + myID + "_div\")' />Credite Card<input name='food_creditecard_" + myID + "' id='food_creditecard_" + myID + "' type='text' /></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='food_addressbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_addressbtn_" + myID + "_div\")' />Address<input name='food_address_" + myID + "' id='food_address_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='food_phonebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_phonebtn_" + myID + "_div\")' />Telephone<input name='food_phone_" + myID + "' id='food_phone_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='food_googleurlbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_googleurlbtn_" + myID + "_div\")' />Google Map<input type='text' name='food_googleurl_" + myID + "' id='food_googleurl_" + myID + "' /><input type='image' src='img/icon/tryit.png	' name='food_googlepreview_" + myID + "' id='food_googlepreview_" + myID + "' class='googlepreview' value='=>' onClick='googlepreview(\"food_googlepreview_" + myID + "\");' /><div name='food_googlepage_" + myID + "' id='food_googlepage_" + myID + "'><div name='food_googlepagedetail_" + myID + "' id='food_googlepagedetail_" + myID + "'></div></div></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='food_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='food_description_" + myID + "' id='food_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='food_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"food_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='food_refname_" + myID + "' id='food_refname_" + myID + "' />URL:<input type='text' name='food_refurl_" + myID + "' id='food_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='food_refsubmit_" + myID + "' id='food_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"food_refsubmit_" + myID + "\");' /><br /><div name='food_attachpage_" + myID + "' id='food_attachpage_" + myID + "'><input type='hidden' name='food_attachurlcount_" + myID + "' id='food_attachurlcount_" + myID + "' value='0' /></div></div>");
	break;
case "activity":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/link-36.png' name='activity_sitebtn_" + myID + "' id='activity_sitebtn_" + myID + "' alt='Official Site' onclick='open_program_detailitem(\"activity_sitebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/archive-24.png' name='activity_categorybtn_" + myID + "' id='activity_categorybtn_" + myID + "' alt='Category' onclick='open_program_detailitem(\"activity_categorybtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/map-32.png' name='activity_googleurlbtn_" + myID + "' id='activity_googleurlbtn_" + myID + "' alt='Google Map' onclick='open_program_detailitem(\"activity_googleurlbtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='activity_descriptionbtn_" + myID + "' id='activity_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"activity_descriptionbtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='activity_refnamebtn_" + myID + "' id='activity_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"activity_refnamebtn_" + myID + "\");' />");
	$("#PanelProgramDetail_" + myID).append("<div id='activity_sitebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_sitebtn_" + myID + "_div\")' />Official Site<input name='activity_site_" + myID + "' id='activity_site_" + myID + "' type='text' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='activity_categorybtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_categorybtn_" + myID + "_div\")' />Category<select name='activity_category_" + myID + "' id='activity_category_" + myID + "'><option value='Dance'>Dance</option><option value='Outdoor'>Outdoor</option><option value='Seminar'>Seminar</option></select></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='activity_googleurlbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_googleurlbtn_" + myID + "_div\")' />Google Map<input type='text' name='activity_googleurl_" + myID + "' id='activity_googleurl_" + myID + "' /><input type='image' src='img/icon/tryit.png	' name='activity_googlepreview_" + myID + "' id='activity_googlepreview_" + myID + "' class='googlepreview' value='=>' onClick='googlepreview(\"activity_googlepreview_" + myID + "\");' /><div name='activity_googlepage_" + myID + "' id='activity_googlepage_" + myID + "'><div name='activity_googlepagedetail_" + myID + "' id='activity_googlepagedetail_" + myID + "'></div></div></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='activity_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='activity_description_" + myID + "' id='activity_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='activity_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"activity_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='activity_refname_" + myID + "' id='activity_refname_" + myID + "' />URL:<input type='text' name='activity_refurl_" + myID + "' id='activity_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='activity_refsubmit_" + myID + "' id='activity_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"activity_refsubmit_" + myID + "\");' /><br /><div name='activity_attachpage_" + myID + "' id='activity_attachpage_" + myID + "'><input type='hidden' name='activity_attachurlcount_" + myID + "' id='activity_attachurlcount_" + myID + "' value='0' /></div></div>");
	break;
case "hotel":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/link-36.png' name='hotel_sitebtn_" + myID + "' id='hotel_sitebtn_" + myID + "' alt='Official Site' onclick='open_program_detailitem(\"hotel_sitebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/archive-24.png' name='hotel_categorybtn_" + myID + "' id='hotel_categorybtn_" + myID + "' alt='Category' onclick='open_program_detailitem(\"hotel_categorybtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/Favorite_24x24.png' name='hotel_starbtn_" + myID + "' id='hotel_starbtn_" + myID + "' alt='Star' onclick='open_program_detailitem(\"hotel_starbtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/Home.png' name='hotel_roombtn_" + myID + "' id='hotel_roombtn_" + myID + "' alt='Room Type' onclick='open_program_detailitem(\"hotel_roombtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/coins.png' name='hotel_pricerangebtn_" + myID + "' id='hotel_pricerangebtn_" + myID + "' alt='Price Range' onclick='open_program_detailitem(\"hotel_pricerangebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/credit_cards.png' name='hotel_creditecardbtn_" + myID + "' id='hotel_creditecardbtn_" + myID + "' alt='Credite Card' onclick='open_program_detailitem(\"hotel_creditecardbtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/addressbook24.png' name='hotel_addressbtn_" + myID + "' id='hotel_addressbtn_" + myID + "' alt='Address' onclick='open_program_detailitem(\"hotel_addressbtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/office5_24.png' name='hotel_phonebtn_" + myID + "' id='hotel_phonebtn_" + myID + "' alt='Telephone' onclick='open_program_detailitem(\"hotel_phonebtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/map-32.png' name='hotel_googleurlbtn_" + myID + "' id='hotel_googleurlbtn_" + myID + "' alt='Google Map' onclick='open_program_detailitem(\"hotel_googleurlbtn_" + myID + "\");'/>");  
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='hotel_descriptionbtn_" + myID + "' id='hotel_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"hotel_descriptionbtn_" + myID + "\");'/>"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='hotel_refnamebtn_" + myID + "' id='hotel_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"hotel_refnamebtn_" + myID + "\");'/>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_sitebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_sitebtn_" + myID + "_div\")' />Official Site<input name='hotel_site_" + myID + "' id='hotel_site_" + myID + "' type='text' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_categorybtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_categorybtn_" + myID + "_div\")' />Category<select name='hotel_category_" + myID + "' id='hotel_category_" + myID + "'><option value='Hotel'>Hotel</option><option value='Motel'>Motel</option><option value='Hostel'>Hostel</option><option value='Dorm'>Dorm</option></select></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_starbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_starbtn_" + myID + "_div\")' />Star<select name='hotel_star_" + myID + "' id='hotel_star_" + myID + "'><option value='6'>over 5 Star</option><option value='5'>5 Star</option><option value='4'>4 Star</option><option value='3'>3 Star</option><option value='2'>2 Star</option><option value='1'>1 Star</option><option value='0'>N/A</option></select></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_roombtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_roombtn_" + myID + "_div\")' />Room Type<select name='hotel_room_" + myID + "' id='hotel_room_" + myID + "'><option value='1-1s'>X1, One Standard</option><option value='2-2s'>X2, Two Standard</option><option value='2-1k'>X2, One King Size</option><option value='others'>Others</option></select></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_pricerangebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_pricerangebtn_" + myID + "_div\")' />Price Range<input name='hotel_pricerange_" + myID + "' id='hotel_pricerange_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_creditecardbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_creditecardbtn_" + myID + "_div\")' />Credite Card<input name='hotel_creditecard_" + myID + "' id='hotel_creditecard_" + myID + "' type='text' /></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_addressbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_addressbtn_" + myID + "_div\")' />Address<input name='hotel_address_" + myID + "' id='hotel_address_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_phonebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_phonebtn_" + myID + "_div\")' />Telephone<input name='hotel_phone_" + myID + "' id='hotel_phone_" + myID + "' type='text' /></div> ");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_googleurlbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_googleurlbtn_" + myID + "_div\")' />Google Map<input type='text' name='hotel_googleurl_" + myID + "' id='hotel_googleurl_" + myID + "' /><input type='image' src='img/icon/tryit.png	' name='hotel_googlepreview_" + myID + "' id='hotel_googlepreview_" + myID + "' class='googlepreview' value='=>' onClick='googlepreview(\"hotel_googlepreview_" + myID + "\");' /><div name='hotel_googlepage_" + myID + "' id='hotel_googlepage_" + myID + "'><div name='hotel_googlepagedetail_" + myID + "' id='hotel_googlepagedetail_" + myID + "'></div></div></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='hotel_description_" + myID + "' id='hotel_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='hotel_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"hotel_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='hotel_refname_" + myID + "' id='hotel_refname_" + myID + "' />URL:<input type='text' name='hotel_refurl_" + myID + "' id='hotel_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='hotel_refsubmit_" + myID + "' id='hotel_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"hotel_refsubmit_" + myID + "\");' /><br /><div name='hotel_attachpage_" + myID + "' id='hotel_attachpage_" + myID + "'><input type='hidden' name='hotel_attachurlcount_" + myID + "' id='hotel_attachurlcount_" + myID + "' value='0' /></div></div>");
	break;
case "transportation":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/link-36.png' name='transportation_sitebtn_" + myID + "' id='transportation_sitebtn_" + myID + "' alt='Official Site' onclick='open_program_detailitem(\"transportation_sitebtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/archive-24.png' name='transportation_categorybtn_" + myID + "' id='transportation_categorybtn_" + myID + "' alt='Category' onclick='open_program_detailitem(\"transportation_categorybtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/CabrioletRed.png' name='transportation_companybtn_" + myID + "' id='transportation_companybtn_" + myID + "' alt='Company' onclick='open_program_detailitem(\"transportation_companybtn_" + myID + "\");' /> ");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='transportation_descriptionbtn_" + myID + "' id='transportation_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"transportation_descriptionbtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='transportation_refnamebtn_" + myID + "' id='transportation_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"transportation_refnamebtn_" + myID + "\");' />");
	$("#PanelProgramDetail_" + myID).append("<div id='transportation_sitebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_sitebtn_" + myID + "_div\")' />Official Site<input name='transportation_site_" + myID + "' id='transportation_site_" + myID + "' type='text' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='transportation_categorybtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_categorybtn_" + myID + "_div\")' />Category<select name='transportation_category_" + myID + "' id='transportation_category_" + myID + "'><option value='Airplant'>Airplant</option><option value='Train'>Train</option><option value='Bus'>Bus</option><option value='Subway'>Subway</option><option value='Boat'>Boat</option></select></div>"); 
	$("#PanelProgramDetail_" + myID).append("<div id='transportation_companybtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_companybtn_" + myID + "_div\")' />Company<input type='text' name='transportation_company_" + myID + "' id='transportation_company_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='transportation_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='transportation_description_" + myID + "' id='transportation_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='transportation_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"transportation_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='transportation_refname_" + myID + "' id='transportation_refname_" + myID + "' />URL:<input type='text' name='transportation_refurl_" + myID + "' id='transportation_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='transportation_refsubmit_" + myID + "' id='transportation_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"transportation_refsubmit_" + myID + "\");' /><br /><div name='transportation_attachpage_" + myID + "' id='transportation_attachpage_" + myID + "'><input type='hidden' name='transportation_attachurlcount_" + myID + "' id='transportation_attachurlcount_" + myID + "' value='0' /></div></div>");
	break;
case "schedule":
	$(thisPanelProgramDetail).remove();
	$("#formProgram_" + myID).append("<div id='PanelProgramDetail_" + myID + "'></div>");
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/comments-24.png' name='schedule_descriptionbtn_" + myID + "' id='schedule_descriptionbtn_" + myID + "' alt='Description' onclick='open_program_detailitem(\"schedule_descriptionbtn_" + myID + "\");' />"); 
	$("#PanelProgramDetail_" + myID).append("<input type='image' src='img/icon/copy24.png' name='schedule_refnamebtn_" + myID + "' id='schedule_refnamebtn_" + myID + "' alt='Reference Information' onclick='open_program_detailitem(\"schedule_refnamebtn_" + myID + "\");' />");
	$("#PanelProgramDetail_" + myID).append("<div id='schedule_descriptionbtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"schedule_descriptionbtn_" + myID + "_div\")' />Description<input size='59' type='text' name='schedule_description_" + myID + "' id='schedule_description_" + myID + "' /></div>");
	$("#PanelProgramDetail_" + myID).append("<div id='schedule_refnamebtn_" + myID + "_div' style='display:none;'><input type='image' src='img/icon/up24.png' name='' id='' onclick='close_program_detailitem(\"schedule_refnamebtn_" + myID + "_div\")' />Reference Information<input type='text' name='schedule_refname_" + myID + "' id='schedule_refname_" + myID + "' />URL:<input type='text' name='schedule_refurl_" + myID + "' id='schedule_refurl_" + myID + "' /><input type='image' src='img/icon/add1-24.png' name='schedule_refsubmit_" + myID + "' id='schedule_refsubmit_" + myID + "' class='refsubmit' value='add' onClick='refsubmit(\"schedule_refsubmit_" + myID + "\");' /><br /><div name='schedule_attachpage_" + myID + "' id='schedule_attachpage_" + myID + "'><input type='hidden' name='schedule_attachurlcount_" + myID + "' id='schedule_attachurlcount_" + myID + "' value='0' /></div></div>");
}
		$(".sortable").sortable({
		placeholder: 'ui-state-highlight'
	});
	$(".sortable").disableSelection();
}

/* Custom function: Tour > Course > Day > Program: Form:
to show the google map on the web through program form. */
function googlepreview(thisID){
	myArry = thisID.split("_");
	thisDetail = "#" + myArry[0] + "_googlepagedetail_" + myArry[2] + "_" + myArry[3] ;                                                                            				
	thisPage =  "#" + myArry[0] + "_googlepage_" + myArry[2] + "_" + myArry[3] ;
	thisURL = "#" + myArry[0] + "_googleurl_" + myArry[2] + "_" + myArry[3] ;
	$(thisDetail).remove();
	$(thisPage).append("<div name='" + thisDetail + "' id='" + thisDetail + "'>" + $(thisURL).attr("value") + "</div>");
	}

/* Custom function: Tour > Course > Day > Program: From:
to load the reference site on the web through program form. */
function refsubmit(thisID){
	myArry = thisID.split("_");
	thisCount = "#" + myArry[0] + "_attachurlcount_" + myArry[2] + "_" + myArry[3] ;
	thisPage = "#" + myArry[0] + "_attachpage_" + myArry[2] + "_" + myArry[3] ;
	thisRefname = "#" + myArry[0] + "_refname_" + myArry[2] + "_" + myArry[3] ;
	thisRefURL = "#" + myArry[0] + "_refurl_" + myArry[2] + "_" + myArry[3] ;
	if ($(thisRefURL).attr("value")=="") return;
	var myRefIndex = $(thisCount).attr("value");
	myRefIndex ++;
	$(thisCount).attr("value",myRefIndex) ;
	divname = "link_" +  myArry[2] + "_" + myArry[3] + "_" + myRefIndex; 
	$(thisPage).append("<div name='" + divname + "' id='" + divname + "'><div>");
	
	$("#" + divname).append("<hr />Reference Name:" + $(thisRefname).attr("value"));
	$("#" + divname).append("<input type='image' src='img/icon/delete24.png' name='r" + divname + "' id='r" + divname + "' onclick='$(\"#" + divname + "\").remove();' value='remove'  /><br />");
	$("#" + divname).append("<iframe name='p" + divname + "' id='p" + divname + "' src='" + $(thisRefURL).attr("value") + "' width='500' heigh='200' style='border:1px'></iframe>");
	$("#" + divname).append("<input type='hidden' name='colResourcelink_" + divname + "' id='colResourcelink_" + divname + "' value='" + $(thisRefURL).attr("value") + "' />");
	$("#" + divname).append("<input type='hidden' name='colResourcelinkname_" + divname + "' id='colResourcelinkname_" + divname + "' value='" + $(thisRefname).attr("value") + "' />");
}

/* Custom function: Tour > Cpurse > Day > Program: open or close program detail div. */
function program_open(myText) {
	myArry = myText.split("_");
	myProgramID = myArry[1] + "_" + myArry[2];
	myStatus = $("#PanelProgramDetail_" + myProgramID).css("display");
	switch ($("#PanelProgramDetail_" + myProgramID).css("display")) {
	case "block":
		$("#PanelProgramDetail_" + myProgramID).css("display","none");
		break;
	case "none":
		$("#PanelProgramDetail_" + myProgramID).css("display","block");
	}
	
}

function open_program_detailitem(thisName) {
	if ($("#" + thisName + "_div").css("display") == "none") {
		$("#" + thisName + "_div").css("display","block");
	} else {
		$("#" + thisName + "_div").css("display","none");
	}
}

function close_program_detailitem(thisName) {
	$("#" + thisName).css("display","none");
}

function edit_tour_basic_information() {
	if ($("#edit_tour_basic_information").attr("value") == "edit") {
		$("#tour_name").removeAttr("disabled");
		$("#tour_startdate").removeAttr("disabled");
		$("#tour_enddate").removeAttr("disabled");
		$("#tour_people").removeAttr("disabled");
		$("#tour_description").removeAttr("disabled");
		$("#edit_tour_basic_information").attr("value","submit");
	} else if ($("#edit_tour_basic_information").attr("value") == "submit") {

		$.post("main_edit_tour_basic_process.php",{
			indexTour:<?php echo $indexTour; ?>,
			tour_name: $("#tour_name").attr("value"),
			tour_startdate: $("#tour_startdate").attr("value"),
			tour_enddate: $("#tour_enddate").attr("value"),
			tour_people: $("#tour_people").attr("value"),
			tour_description: $("#tour_description").attr("value")
		},
		function(data) {
			//alert("<?php echo $indexTour; ?>" + data);
			if (data == "true") {
				alert("Tour basic information is modified successfully.");
			} else if (data == "false") {
				alert("Edit fail, data are not changed. Please try again.");
			}
		});

		$("#tour_name").attr("disabled","disabled");
		$("#tour_startdate").attr("disabled","disabled");
		$("#tour_enddate").attr("disabled","disabled");
		$("#tour_people").attr("disabled","disabled");
		$("#tour_description").attr("disabled","disabled");
		$("#edit_tour_basic_information").attr("value","edit");
		window.location.reload();
		}
}

function program_detail_addok_btn(thisID,thisAction) {
	thisLabel = $("#program_select_" + thisID).val();
	colResourcelink = "";
	colResourcelinkname = "";
	for (i=1;i<=$("#" + thisLabel + "_attachurlcount_" + thisID).val();i++) {
		colResourcelink = colResourcelink + $("#colResourcelink_link_" + thisID + "_" + i).val() + ",";
		colResourcelinkname = colResourcelinkname + $("#colResourcelinkname_link_" + thisID + "_" + i).val() + ",";
	}
	colResourcelink = colResourcelink.substring(0,colResourcelink.length-2);
	colResourcelinkname = colResourcelinkname.substring(0,colResourcelinkname.length-2);
	$.post("main_edit_program_process.php", {
		thisID: thisID,
		indexCourse: <?php echo $indexTour;?>,
		indexProgram: $("#indexProgram_" + thisID).val(),
		indexResource: $("#indexResource_" + thisID).val(),
		action: thisAction,
		colResourcelink: colResourcelink,
		colResourcelinkname: colResourcelinkname,
		program_select: $("#program_select_" + thisID).val(),
		program_name: $("#program_name_" + thisID).val(),
		program_starttime: $("#program_starttime_" + thisID).val(),
		program_endtime: $("#program_endtime_" + thisID).val(),
		site: $("#" + thisLabel + "_site_" + thisID).val(),
		googleurl: $("#" + thisLabel + "_googleurl_" + thisID).val(),
		attachurlcount: $("#" + thisLabel + "_attachurlcount_" + thisID).val(),
		description: $("#" + thisLabel + "_description_" + thisID).val(),
		category: $("#" + thisLabel + "_category_" + thisID).val(),
		pricerange: $("#" + thisLabel + "_pricerange_" + thisID).val(),
		creditecard: $("#" + thisLabel + "_creditecard_" + thisID).val(),
		address: $("#" + thisLabel + "_address_" + thisID).val(),
		phone: $("#" + thisLabel + "_phone_" + thisID).val(),
		hotel_star: $("#hotel_star_" + thisID).val(),
		hotel_room: $("#hotel_room_" + thisID).val(),
		transportation_company: $("#transportation_company_" + thisID).val()
		}, 
		function(data) {
			if (data == "true") {$("#program_detail_addok_btn_" + thisID).attr("src","./img/icon/ok-32.png");} else {alert(data);}
			// input border non-display
			program_open("PanelProgramOpen_" + thisID);
			});
}
</script>